use std::ops::Range;
use std::time::Duration;

pub struct Config {
    /// 循环次数,默认3
    pub cycle_num: u32,
    pub focus_duration: Duration,
    pub short_break: ShortBreak,
    pub long_break: LongBreak,
}

impl Default for Config {
    fn default() -> Self {
        Self {
            cycle_num: 2,
            focus_duration: Duration::from_secs(90 * 60),
            short_break: ShortBreak::default(),
            long_break: LongBreak::default(),
        }
    }
}

pub struct LongBreak {
    pub duration: Duration,
    pub tone: String,
}

pub struct ShortBreak {
    pub random_range: Range<u32>,
    pub tone: String,
}

impl Default for ShortBreak {
    fn default() -> Self {
        Self {
            random_range: 3..6,
            tone: "I:/00.WorkSpace/rust/focus90min/resource/di.wav".to_string(),
        }
    }
}

impl Default for LongBreak {
    fn default() -> Self {
        Self {
            duration: Duration::from_secs(20 * 60),
            tone: "I:/00.WorkSpace/rust/focus90min/resource/ding.mp3".to_string(),
        }
    }
}
